// TOWN SCRIPT
//    Town 14: Lair

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documenation. States you write
// yourself should be numbered from 10-100.

// flags:
// 14, 0 = have talked to the she-devil
// 14, 1 = she-devil is mad...
// 14, 2 = chest unlocked
// 14, 4 = knows you have doll and you haven't given it to her
// 14, 5 = set if you have succumbed to her wiles
// 14, 6 = found out about doll from she-devil

begintownscript;

variables;

short choice;

body;

beginstate INIT_STATE;
	set_crime_tolerance(1);
	turn_off_training(1);

	set_name(6, "She-Devil");
	if (get_flag(14, 1) == 0)
		set_char_dialogue_pic(6, 520, 0); // not mad
	else
		set_char_dialogue_pic(6, 521, 0); // mad

	// create guarding group
	add_range_to_group(7, 10, 1);
break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;

break;

beginstate 10;
	message_dialog("It appears that this route out goes straight to hell.", "This probably isn't the way back.");
	block_entry(1);
break;

beginstate 11;
	block_entry(1);
	reset_dialog_preset_options(3);
	choice = run_dialog(1);
	if (choice == 2) {
		play_sound(10);
		move_to_new_town(12, 22, 24);
	}
break;

beginstate 12;
	message_dialog("The portal hums with a mysterious power, active and waiting for someone to enter it.", "");
break;

beginstate 13;
	message_dialog("The heat of the lava is too intense for you to continue on.", "");
	block_entry(1);
break;

beginstate 14;
	if (get_flag(14, 3) == 0) {
		set_flag(14, 3, 1);
		reset_dialog();
		add_dialog_str(0, "Ahead of you is a hot, steamy cave with lava pools covering the floor.", 0);
		add_dialog_str(1, "Through the dim light, you see several large creatures seemingly standing guard.", 0);
		add_dialog_str(2, "A very pretty woman, strangely glowing greenish within the cave, is pacing around a campfire in the center.", 0);
		add_dialog_str(3, "This must be the she-devil!", 0);
		add_dialog_choice(0, "OK");
		choice = run_dialog(1);
	}
break;
